<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>增加广告</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
    <link href="__PUBLIC__/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/layui.css" rel="stylesheet">
    <link href="__PUBLIC__/Common/layui/src/css/layui.css" rel="stylesheet">

    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/uedit/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/uedit/ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/uedit/lang/zh-cn/zh-cn.js"></script>

    <style>
        #detail_pic, #list_pic, #index_pic {
            width: 150px;
            height: 110px;
        }

        #upload_img_list {
            margin: 10px 0 0 0
        }

        #upload_img_list dd {
            position: relative;
            margin: 0 10px 10px 0;
            float: left
        }

        #upload_img_list .operate {
            position: absolute;
            top: 0;
            right: 0;
            z-index: 1
        }

        #upload_img_list .operate i {
            cursor: pointer;
            background: #2F4056;
            padding: 2px;
            line-height: 15px;
            text-align: center;
            color: #fff;
            margin-left: 1px;
            float: left;
            filter: alpha(opacity=80);
            -moz-opacity: .8;
            -khtml-opacity: .8;
            opacity: .8
        }

        #upload_img_list dd .img {
            max-height: 150px;
            max-width: 500px
        }


    </style>


</head>

<body class="white-bg">
<div class="wrapper wrapper-content">
    <form role="form" method="post" action="{:U('Admin/Banner/add')}">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">绑定商品:</label>
                        <div class="col-sm-10">
                            <select class="form-control m-b" name="band_id">
                                <volist name="goods_list" id="vo">
                                <option value="{$vo.id}">{$vo.title}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">广告排序:</label>
                        <div class="col-sm-10">
                            <input placeholder="广告排序(数值小的排序靠前)，默认 50" name="numbers" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">封面图片：</label>
                        <div class="form-group">
                            <div class="col-sm-6">
                                <input type="hidden" name="files1" id="file1" class="form-control" value="{$info.photo}">
                                <div id="fileImgDiv1" style="display: none"><img src="" alt="" id="fileImg" width="200px"></div>
                                <button type="button" class="layui-btn" id="index_pic">
                                    <i class="layui-icon">&#xe67c;</i>点击上传图片<br/>
                                    <i>jpg/png,300*220px</i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="hr-line-dashed"></div>
        <div class="form-group">
            <div class="col-sm-12 col-sm-offset-2">
                <button class="btn btn-primary" type="submit">保存</button>

            </div>
        </div>
    </form>
</div>
<script src="__PUBLIC__/Common/layer/layer.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/Admin/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/Admin/js/plugins/summernote/summernote.min.js"></script>
<script src="__PUBLIC__/Admin/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="__PUBLIC__/Common/layui/src/layui.js"></script>
<script>
    layui.use('upload', function () {
        var upload = layui.upload;

        //礼物图片
        var uploadInst = upload.render({
            elem: '#index_pic' //绑定元素
            , url: "{:U('Base/file_upload')}&type=photo" //上传接口
            , before: function () {
                layer.msg('图片上传中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            }
            , done: function (res) {
                if (res.code == 0) {
                    layer.alert(res.msg, {
                        icon: 7,
                        closeBtn: 0
                    }, function () {
                        layer.closeAll();
                    });
                }
                //上传完毕回调
                console.log(res);
                layer.msg(res.msg);
                $('#file1').val(res.data.domain_url_size);
                $('#fileImgDiv1').show();
                $('#fileImg').attr('src', res.data.domain_url_size)
            }
            , error: function (res) {
                //请求异常回调
//                console.log(res);
            }
        });
    });


    $(document).ready(function () {
        $(".summernote").summernote({lang: "zh-CN"})
    });
    var edit = function () {
        $("#eg").addClass("no-padding");
        $(".click2edit").summernote({lang: "zh-CN", focus: true})
    };
    var save = function () {
        $("#eg").removeClass("no-padding");
        var aHTML = $(".click2edit").code();
        $(".click2edit").destroy()
    };
</script>

</body>


</html>

